﻿@inject IStringLocalizer<BootstrapBlazor.Shared.Samples.SearchDialogs> Localizer
@inject DialogService DialogService

<Button Text="@Localizer["SearchDialogsLayoutButtonText1"]" OnClickWithoutRender="@ShowInlineDialog" />
<Button Text="@Localizer["SearchDialogsLayoutButtonText2"]" OnClickWithoutRender="@ShowInlineAlignDialog" />

@code {
    private async Task ShowInlineDialog()
    {
        var model = new Foo();
        var option = new SearchDialogOption<Foo>()
        {
            Title = "Search popup",
            ItemsPerRow = 2,
            RowType = RowType.Inline,
            Model = model,
            Items = Utility.GenerateColumns<Foo>(p => p.GetFieldName() == nameof(Foo.Name) || p.GetFieldName() == nameof(Foo.Address))
        };
        await DialogService.ShowSearchDialog(option);
    }

    private async Task ShowInlineAlignDialog()
    {
        var model = new Foo();
        var option = new SearchDialogOption<Foo>()
        {
            Title = "Search popup",
            ItemsPerRow = 2,
            RowType = RowType.Inline,
            LabelAlign = Alignment.Right,
            Model = model,
            Items = Utility.GenerateColumns<Foo>(p => p.GetFieldName() == nameof(Foo.Name) || p.GetFieldName() == nameof(Foo.Address))
        };
        await DialogService.ShowSearchDialog(option);
    }
}
